/*
 * @Author: LVGRAPE
 * @LastEditors: LVGRAPE
 */
#include "ch1115.h"
#include <rtthread.h>
#include <rtdevice.h>


void OLED_OpenACG(void) // 开机动画
{
    for (uint8_t i = 0; i < 40; i++) // 中间展开一条横线
    {
        OLED_DrawRectangle(32 - i, 40, 2 * i, 2, OLED_FILLED);
        OLED_Update(0, 0, 128, 32);
        rt_thread_mdelay(8);
    }

    // for (uint8_t i = 0; i < 16; i++) // 升起Hello文字
    // {
    //     OLED_ShowString(43, 40 - i, "Hello", OLED_8X16);
    //     OLED_Clear(23, 40, 80, 20);                     // 遮盖
    //     OLED_DrawRectangle(23, 40, 80, 2, OLED_FILLED); // 横线
    //     OLED_Update(0, 0, 128, 32);
    //     rt_thread_mdelay(10);
    // }
    // rt_thread_mdelay(1000);
    // OLED_Clear(0, 0, 128, 64); // 清屏
}
#include <stdlib.h>
void ch1115_test(int argc, char *argv[])
{
    rt_memset(OLED_DisplayBuf, 0, sizeof(OLED_DisplayBuf));
    OLED_Init();
    // OLED_Update(0, 0, 128, 32);

    int x = atoi(argv[1]);
    int y = atoi(argv[2]);
    // OLED_OpenACG();
    OLED_DrawPoint(x,y);
    OLED_Update(0, 0, 128, 64);
    rt_kprintf("drawPoint(%d,%d)\n",x,y);
}

MSH_CMD_EXPORT(ch1115_test, test ch1115 oled driver);

